@extends('layouts.app')

@section('content')
<div class="easyui-layout" style="width:100%;height:762px;">
	<div data-options="region:'center',iconCls:'icon-save'" title="单位管理" class="easy_center">
		<div class="easyui-tabs" style="width:100%;" data-options="border:false,fit:true,plain:true">
			<div title="编辑" style="padding:10px">
				<form name="add_form" id="add_form" method="post" enctype="multipart/form-data">
					<input type="hidden" name="_token" value="{{ csrf_token() }}">
					<div id="div_print">
						<h2 class="text-center mg_b36 mg_t25">治安保卫重点单位基本情况登记表</h2>
						<table class="table-form table-border w1000 mg-auto">
							<tbody>
							<tr>
								<td>单位名称</td>
								<td colspan="5"><input type="text" class="form-input" value="{{$re->name}}" name="name"></td>
							</tr>
							<tr>
								<td>原市、区、派出所</td>
								<td colspan="5">{{getValue($re->city,'area','id','name')}}{{getValue($re->area,'area','id','name')}}{{getValue($re->org_id,'area','id','name')}}</td>
							</tr>
							<tr>
								<td>新市、区、派出所</td>
								<td colspan="5">
									<div class="col-sm-3">
										<select id="city" name="city" class="w150 input_all">
											<option value="">请选择</option>
											@foreach($city as $v)
												<option value="{{$v->id}}">{{$v->name}}</option>
											@endforeach
										</select>
									</div>
									<div class="col-sm-3">
										<select id="area" name="area" class="w150 input_all">
											<option value="">请选择</option>
										</select>
									</div>
									<div class="col-sm-3">
										<select id="org_id" name="org_id" class="w150 input_all">
											<option value="">请选择</option>
										</select>
									</div>
								</td>
							</tr>
							<tr>
								<td>详细地址</td>
								<td colspan="5"><input type="text" class="form-input"  value="{{$re->address}}" name="address"></td>
							</tr>
							<tr>
								<td>企业性质</td>
								<td>
									<input type="text" class="form-input" value="{{$re->xingzhi}}" name="xingzhi">
								</td>
								<td>邮编</td>
								<td colspan="3">
									<input type="text" class="form-input" value="{{$re->post_code}}" name="post_code">
								</td>
							</tr>
							<tr>
								<td>法人代表（主要负责人）</td>
								<td>
									<input type="text" class="form-input" value="{{$re->frdb_name}}" name="frdb_name">
								</td>
								<td>职务</td>
								<td>
									<input type="text" class="form-input" value="{{$re->frdb_post}}" name="frdb_post">
								</td>
								<td>电话</td>
								<td>
									<input type="text" class="form-input" value="{{$re->frdb_phone}}" name="frdb_phone">
								</td>
							</tr>
							<tr>
								<td>分管保卫领导</td>
								<td>
									<input type="text" class="form-input" value="{{$re->fgbwld_name}}" name="fgbwld_name">
								</td>
								<td>职务</td>
								<td>
									<input type="text" class="form-input" value="{{$re->fgbwld_post}}" name="fgbwld_post">
								</td>
								<td>电话</td>
								<td>
									<input type="text" class="form-input" value="{{$re->fgbwld_phone}}" name="fgbwld_phone">
								</td>
							</tr>
							<tr>
								<td>保卫机构名称</td>
								<td>
									<input type="text" class="form-input" value="{{$re->bwjg_name}}" name="bwjg_name">
								</td>
								<td>人数</td>
								<td>
									<input type="text" class="form-input" value="{{$re->bwjg_num_of_peo}}" name="bwjg_num_of_peo">
								</td>
								<td>保卫专干</td>
								<td>
									<input type="text" class="form-input" value="{{$re->bwjg_zhuangan}}" name="bwjg_zhuangan">
								</td>
							</tr>
							<tr>
								<td>护卫队人数</td>
								<td>
									<input type="text" class="form-input" value="{{$re->hwd_num_of_peo}}" name="hwd_num_of_peo">
								</td>
								<td>保安数</td>
								<td colspan="3">
									<input type="text" class="form-input" value="{{$re->baoan_num_of_peo}}" name="baoan_num_of_peo">
								</td>
							</tr>
							<tr>
								<td>保卫负责人</td>
								<td>
									<input type="text" class="form-input" value="{{$re->bwfzr_name}}" name="bwfzr_name">
								</td>
								<td>职务</td>
								<td>
									<input type="text" class="form-input" value="{{$re->bwfzr_post}}" name="bwfzr_post">
								</td>
								<td>电话</td>
								<td>
									<input type="text" class="form-input" value="{{$re->bwfzr_phone}}" name="bwfzr_phone">
								</td>
							</tr>
							<tr>
								<td>职工总数</td>
								<td>
									<input type="text" class="form-input" value="{{$re->zhigong_num_of_peo}}" name="zhigong_num_of_peo">
								</td>
								<td>在职</td>
								<td colspan="3">
									<input type="text" class="form-input" value="{{$re->zaizhi_num_of_peo}}" name="zaizhi_num_of_peo">
								</td>
							</tr>
							<tr>
								<td>固定资产</td>
								<td>
									<input type="text" class="form-input" value="{{$re->gdzc}}" name="gdzc">
								</td>
								<td>经营状况</td>
								<td colspan="3">
									<input type="text" class="form-input" value="{{$re->jyzk}}" name="jyzk">
								</td>
							</tr>
							<tr>
								<td>重点要害部位</td>
								<td>
									<input type="text" class="form-input" value="{{$re->zdyhbw_name}}" name="zdyhbw_name">（处）
								</td>
								<td colspan="2">要害部位工作人员数</td>
								<td colspan="2">
									<input type="text" class="form-input" value="{{$re->zdyhbw_num_of_peo}}" name="zdyhbw_num_of_peo">（人）
								</td>
							</tr>
							<tr>
								<td>重点维稳工作对象</td>
								<td>
									<select class="w150 input_all" name="zdwwgzdx">
										<option value="有" @if($re->zdwwgzdx == '有') selected @endif>有</option>
										<option value="无" @if($re->zdwwgzdx == '无') selected @endif>无</option>
									</select>
								</td>
								<td>数量</td>
								<td>
									<input type="text" class="form-input" value="{{$re->zdwwgzdx_num_of_peo}}" name="zdwwgzdx_num_of_peo">（人）
								</td>
								<td>其中骨干</td>
								<td>
									<input type="text" class="form-input" value="{{$re->zdwwgzdx_gg_num_of_peo}}" name="zdwwgzdx_gg_num_of_peo">（人）
								</td>
							</tr>
							<tr>
								<td>单位类型</td>
								<td>
									<select class="w150 input_all" name="type">
										<option value="">请选择单位类型</option>
										@foreach($type as $k=>$v)
											<option value="{{$v->id}}" @if($re->type == $v->id) selected @endif>{{$v->name}}</option>
										@endforeach
									</select>
								</td>
								<td>经度</td>
								<td>
									<input type="text" class="form-input" name="jd" value="{{$re->jd}}">
								</td>
								<td>纬度</td>
								<td>
									<input type="text" class="form-input" name="wd" value="{{$re->wd}}">
								</td>
							</tr>
							<tr>
								<td>备注</td>
								<td colspan="5">
									<textarea class="textarea">{{$re->remark}}</textarea>
								</td>
							</tr>
							</tbody>
						</table>
						<div class="w1000 wbt mg_t25 pd_b20 text-center">
							<button type="submit" class="easyui-linkbutton dsp" data-options="iconCls:'icon-save'">确定</button>
							<a href="javascript:history.back(-1);" class="easyui-linkbutton dsp" data-options="iconCls:'icon-back'">返回</a>
							<a href="print.html" id="goToPageB" class="easyui-linkbutton dsp print" data-options="iconCls:'icon-print'">打印</a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>


<script type="text/javascript">
	$(document).on("change",'#city', function(){
		$('#area option:gt(0)').remove();
		$('#org_id option:gt(0)').remove();
		//alert(1);die;
		var cid = $("#city").val();
		var url = "{{url('admin/getArea')}}";
		$.getJSON(url,{cid:cid},function(json){
			/*清空原有的选项*/
			if(json != ''){
				$.each(json,function(index,array){
					var option = "<option value='"+array['id']+"'";
					option += ">"+array['name']+"</option>";
					$("#area").append(option);
				});
			}
		});
	});

	$(document).on("change",'#area', function(){
		$('#org_id option:gt(0)').remove();
		var cid = $("#area").val();
		var url = "{{url('admin/getArea')}}";
		$.getJSON(url,{cid:cid},function(json){
			/*清空原有的选项*/
			if(json != ''){
				$.each(json,function(index,array){
					var option = "<option value='"+array['id']+"'";
					option += ">"+array['name']+"</option>";
					$("#org_id").append(option);
				});
			}
		});
	});
</script>

@stop
